<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
String baseInfoJson= (String)request.getAttribute("baseInfoJson");
String transferDeptInfoJson= (String)request.getAttribute("transferDeptInfoJson");
%>

<html>
<head>
<title>解放军第三〇五医院</title>
<link rel="stylesheet" href="${basePath}assets/css/medical_record/home_page.css"/>
</head>
<body>
<input type="hidden" id="firstGuid" value="${firstGuid}">
<input type="hidden" id="mrId" value="${mrId}">
<input type="hidden" id="visitNumber" value="${visitNumber}">

 <table style="width:100%;" cellspacing="0" cellpadding="0">
		<tbody>
			<tr>
				<td align="left" colspan="6" class="dark">
					<div style="float:right;">
						<input type="submit" value="重新提取"  id="repeatFetchProgressNoteData" class="btn" style="width: 80px; cursor: pointer; border-radius: 5%;">&nbsp;
					</div>
                </td>
			</tr>
		</tbody>
</table>

<div id="containt" style="overflow:auto; height:800px; margin-top: 20px;">
</div>

</body>
<script type="text/javascript" src="${basePath}assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}assets/js/html2cancas.min.js"></script>
<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_defined.css" rel="stylesheet" type="text/css">
    
<script type="text/javascript">

$(function() {
	$("#repeatFetchProgressNoteData").click(function () {
		var loadingIndex = null;
		var visitGuid = $("#firstGuid").val();
		var visitNumber = $("#visitNumber").val();
		var mrId = $("#mrId").val();
		
		layer.confirm("您确定重新提取病程记录吗?",{
            btn : [ '确定', '取消' ]//按钮
        }, function(index) {
        	layer.close(index);
        	jQuery.support.cors = true;
    		$.ajax({
    			type:"get",
    		    //url:"http://localhost:28088/medical-export/export305/ajaxRepeatFetchProgressNoteDataByMrIdAndVisitNumber",  
    			 url:"http://132.147.0.48:8090/medical-export/export305/ajaxRepeatFetchProgressNoteDataByMrIdAndVisitNumber", 
    			data:{'visitGuid':visitGuid, 'mrId':mrId, 'visitNumber':visitNumber},
    			beforeSend:function(){
    			          loadingIndex = layer.load(1, {
    					  shade: [0.1,'#fff'] //0.1透明度的白色背景
    			    });
        	 	},
    			success:function(data){
    				console.log(data);
    				layer.close(loadingIndex);
    				if(data.success) {
    					layer.alert("成功", {icon:1});
    					window.location = '${basePath}medical_record/edit_home_page_visit_progress_note_form?visitGuid='+visitGuid;
    				} else {
    					layer.alert(data.msg, {icon:2});
    				}
    			},
    			error:function(){
    				layer.close(loadingIndex);
    				layer.alert('服务器异常!',{icon:2});
    			}
    		}) //ajax end
    		
		});
		
	});
	
	
});

function initProgressNote(guid) {
  
	var url = "${basePath}medical_record/getProgressNote";

	var dataform = {"visitGuid":guid};
	//var dataform = {"visitGuid":"14aa595a06cc428690f875db3e60b66b"};
    //console.log(url)
	$.ajax({
	    type:"get",
	    url:url,
	    dataType:"json",
	    data:dataform,
	    beforeSend:function(){
	    	 $("#containt").html("");
	 	},
	    success:function(result){
	    	//console.log(result)
	         if(result.success){
	            var data = result.data;
	            if (data != null && data.length > 0) {
	            	  var content = "";
	            	   $.each(data, function(index, htmlStr) {
	            		   content+="<div>"+htmlStr+"</div>";
	            	   });
	            	 $("#containt").html("");
	            	 $("#containt").html(content);
	               }else{
	            	   layer.alert("暂无数据",{icon:7})
	               }
	         }else{
	                layer.alert(result.msg,{icon:7})
	         }
	    },
	    error:function(XMLHttpRequest, textStatus, errorThrown) {
	          if(XMLHttpRequest.status == 403) {
	                 layer.alert("没有权限!",{icon:7});
	          }
	    }  //error end 
	}); //ajax 结束	
	
}
var guid=$("#firstGuid").val();

initProgressNote(guid);

</script>

</html>

